//第2关 编写一个圆环类

package step2;

public class Ring {
	private double innerRadius;
	private double outerRadius;
	private String color;
	
	
                                                     
	public Ring() {
		
	}

	public Ring(double innerRadius, double outerRadius, String color) {
		this.innerRadius = innerRadius;
		this.outerRadius = outerRadius;
		this.color = color;
	}

	public double getInnerRadius() {
		return innerRadius;
	}

	public void setInnerRadius(double innerRadius) {
		this.innerRadius = innerRadius;
	}

	public double getOuterRadius() {
		return outerRadius;
	}

	public void setOuterRadius(double outerRadius) {
		this.outerRadius = outerRadius;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}
 
	public double getArea() {
		double area = Math.PI*(Math.pow(outerRadius,2)-Math.pow(innerRadius, 2));
		return area;
	}
	
	public double getOuterGirth() {
		return (2*Math.PI*outerRadius);
	}
	
	public double getInnerGirth() {
		return (2*Math.PI*innerRadius);
	}
	
	public static void main(String[] args) {
		Ring ring = new Ring(5, 8, "red");
		System.out.println("圆环的内半径: " + ring.innerRadius);         
		System.out.println("圆环的外半径: " + ring.outerRadius);                                    
		System.out.println("圆环的颜色: " + ring.color);                                      
		System.out.println("圆环的面积: " + String.format("%.2f", ring.getArea()));                             
		System.out.println("圆环的外圆周长: " + String.format("%.2f", ring.getOuterGirth()));                                  
		System.out.println("圆环的内圆周长: " + String.format("%.2f", ring.getInnerGirth()));                                    

		ring.setInnerRadius(4);
		ring.setOuterRadius(6);
		ring.setColor("blue");
        System.out.println();
		System.out.println("圆环的内半径: " + ring.innerRadius);                                     
		System.out.println("圆环的外半径: " + ring.outerRadius);                                      
		System.out.println("圆环的颜色: " + ring.color);                                        
		System.out.println("圆环的面积: " + String.format("%.2f", ring.getArea()));                                       
		System.out.println("圆环的外圆周长: " + String.format("%.2f", ring.getOuterGirth()));                                    
		System.out.println("圆环的内圆周长: " + String.format("%.2f", ring.getInnerGirth()));
	}
}